<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>16-函数取数组最大值</title>
</head>
<body>
    <script>
        function fn(arr = []){
            let max = arr[0]
            // 最小值
            let min = arr[0

            ]
            for(let i = 1; i < arr.length; i++){
                if(max < arr[i]){
                    max = arr[i]
                }
                // 最小值
                if(min > arr[i]){
                    min = arr[i]
                }
            }
            return [max, min]
        }
        let fnArr = fn([1, 3 ,6, 22, 89, 77, 19])
        console.log(fnArr);
        
    </script>
</body>
</html>